from rest_framework import serializers
from .models import *
from goods.serializers import GoodSerializer


class UserFavDetailSerializer(serializers.ModelSerializer):
    goods = GoodSerializer()
    class Meta:
        model = UserFav
        fields = ('goods', 'id')

class UserFavSerializer(serializers.ModelSerializer):
    user = serializers.HiddenField(default=serializers.CurrentUserDefault())
    class Meta:
        model = UserFav
        fields = ('user', 'goods', 'id')



class UserLeavingMessageSerializer(serializers.ModelSerializer):
    user = serializers.HiddenField(default=serializers.CurrentUserDefault())
    class Meta:
        model = UserLeavingMessage
        fields = '__all__'



class UserAddressSerializer(serializers.ModelSerializer):
    user = serializers.HiddenField(default=serializers.CurrentUserDefault())
    class Meta:
        model = UserAddress
        fields = '__all__'